package senior.DateExer;

import java.util.Calendar;
import java.util.Date;

/**
 * 计算当前时间距“世界末日”已经过去了多少天（2012-12-21）
 *
 * @author shkstart
 * @creat 2022-04-15:44
 */
public class Exer2 {
    public static void main(String[] args) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(new Date());
        //把今天的日期转换成毫秒数
        long now = cal.getTimeInMillis();
        cal.set(2012, 11, 21);
        long time = cal.getTimeInMillis();
        System.out.println("世界末日已过去" + (now - time) / 1000 / 3600 / 24 + "天");

    }

}
